#include <bits/stdc++.h>
using namespace std;
int a[101];
bool dp[10000];
int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);}
int main()
{
#ifdef LOCAL
    freopen("PREV-36.in", "r", stdin);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, g;
    cin >> n;   
    dp[0] = true;
    for(int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        if(i == 1) g = a[1];
        else g = gcd(g, a[i]);

        for(int j = 0; j <= 10000; ++j)
        {
            if(dp[j]) dp[j + a[i]] = true;        
        }
    }
    if(g != 1) cout << "INF" << endl;
    else
    {
        int ans = 0;
        for(int j = 0; j <= 10000; j++)
        {
            if(!dp[j]) ans += 1;
        }
        cout << ans << endl;
    }
    
    return 0;
}